<template>
  <div>
    
    <page-list
      :url="url"
      :params="filter"
      @initList="_initList"
      ref="pageList"
    >
      <van-cell
        class="card"
        @click="openDetail(item)"
        v-for="(item, index) in list"
        :key="index"
      >
        <div>
          <div>
            <div class="title">
              <div>{{ item.PurposeInterview }}</div>
            </div>
            <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_company_check.png"
                />风险分级管控名称：{{ item.TemplateName }}
              </van-col>
            </van-row>
            <van-row>
              <van-col span="24">
                
                <div
                  style="margin-top: 10px; margin-bottom: 10px"
                  id="divFile"
                >
                
                  <file-list-read-only
                    :attachs="item.TemplateAttachs"
                    :labelName="'模板文件'"
                  ></file-list-read-only>
                </div>
              </van-col>
            </van-row>
            <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_danger_main_hiddendanger.png"
                />是否必须上传：{{ item.IsMustInput == true ? '是' : '否' }}
              </van-col>
            </van-row>
           <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_danger_main_corrective.png"
                />状态: {{ item.StatusName }}
              </van-col>
            </van-row>
            <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_list_user.png"
                />上传人: {{ item.CreateChnName }}
              </van-col>
            </van-row>
            <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_danger_main_assign.png"
                />上传时间: {{ item.CreateDate }}
              </van-col>
            </van-row>
            <van-row>
              <van-col span="24">
                <div class="dep_btm">
                  <div
                    class="btm_item"
                    v-if="item.Status == 10"
                    @click.stop="submitData(item)"
                  >
                    <img
                      src="@/assets/Images/AppIcon/activity_examresult_right.png"
                      alt=""
                    />
                    <div class="mr-10">提交</div>
                  </div>
                  <div
                    class="btm_item"
                    @click.stop="openEdit(item)"
                    style="margin-right: 15px"
                  >
                    <img src="@/assets/Images/AppIcon/icon_list_edit.png" alt="" />
                    <div>上传文件</div>
                  </div>
                  <div
                    class="btm_item"
                    @click.stop="openDetail(item)"
                    style="margin-right: 15px"
                  >
                    <img src="@/assets/Images/AppIcon/icon_list_view.png" alt="" />
                    <div>查看详情</div>
                  </div>
                </div>
              </van-col>
            </van-row>
          </div>
        </div>
      </van-cell>
    </page-list>
  </div>
</template>

<script>
import PageList from "../../../components/PageList/PageList.vue";
import { getMenuByMenuCode } from "@/api/common";
import FileListReadOnly from "../../../components/Attach/FileListReadOnlyYat.vue";
export default {
  components: { PageList,FileListReadOnly },
  data() {
    return {
      rightValue: 0,
      url: '/YatManagementFXDocsApi/GetPageData',
      list: [],
      filter: {
        dataType: "List",
      },
    };
  },
  created() {
    this.getMenuByMenuCode();
  },
  methods: {
    _initList(list) {
      this.list = list;
    },
    openDetail(item) {
      this.$router.push({
        path: "/YatManagementDocsFx/Detail",
        query: { id: item.ID, templateId: item.TemplateId },
      });
    },
    add() {
      this.$router.push({ path: "/YatManagementDocsFx/Edit" ,
        query: { id: 0 },});
    },
    openEdit(obj) {
      this.$router.push({
        path: "/YatManagementDocsFx/Edit",
        query: { id: obj.ID , templateId: obj.TemplateId },
      });
      return true;
    },
    submitData(item) {
      this.$dialog
        .confirm({
          title: "询问",
          message: "您确定要提交该风险分级管控吗？",
        })
        .then(() => {
          let params = { id: item.ID };
          this.$axios
            .get('/YatManagementFXDocsApi/SubmitDoc', {
              params: params,
            })
            .then((res) => {
              this.$toast("提交成功");
              this.$refs.pageList.refreshList();
            });
        })
    },
    getMenuByMenuCode() {
      var me = this;
      getMenuByMenuCode("GxInterviewRecord_List").then((res) => {
        me.rightValue = res.data ? res.data.RoleRightValue : 0;
      });
    },
  },
};
</script>
<style lang="less" scoped>
.dep_btm {
  display: flex;
  justify-content: flex-end;
  line-height: 27px;
  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}

.icon {
  vertical-align:middle;
}
</style>
